<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>新增帐号</title>
<script>
	function doAdd(){
		if(validForm()){
			document.form1.submit();
		}
	}
	function validForm(){
		var f=document.form1;
		if(document.getElementById("account").value==""){
			alert("您没有输入帐号哦");
			document.getElementById("account").focus();
			return false;
		}
		if(document.getElementById("password").value==""){
			alert("您没有输入密码哦");
			document.getElementById("password").focus();
			return false;
		}else if(document.getElementById("password").value.length<6){
			alert("您的密码不应小于6位");
			document.getElementById("password").focus();
			return false;
		}
		if(document.getElementById("repassword").value==""){
			alert("您没有输入重复密码哦");
			document.getElementById("password").focus();
			return false;
		}else if(document.getElementById("password").value!=document.getElementById("repassword").value){
			alert("您的密码与重复密码不一致");
			return false;
		}
		if(document.getElementById("code").value==""){
			alert("您没有输入验证码哦");
			document.getElementById("code").focus();
			return false;
		}
		return true;
	}
</script>
</head>
<body>
	<form action="../account/save.action" name="form1" method="post">
	<table  width="100%" height="100" cellpadding="3" cellspacing="0" border="1" 
		bordercolordark="ffffff" bordercolorlight="#cccccc">
		<tr>
			<td colspan="2">新增</td>
		</tr>
		<tr>
			<td>类型:</td>
			<td>
				<select name="type">
					<option value="">--请选择--</option>
					<option value="1">类型1</option>
					<option value="2">类型2</option>
					<option value="3">类型3</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>名称:</td>
			<td><input name="account.name" id="name" type="text" value=""/></td>
		</tr>
		<tr>
			<td>说明:</td>
			<td><input name="account.caption" id="caption" type="text" value=""/></td>
		</tr>
		<tr>
			<td>帐号:</td>
			<td><input name="account.account" id="account" type="text" value=""/></td>
		</tr>
		<tr>
			<td>密码:</td>
			<td><input name="account.password" id="password" type="password" value=""/></td>
		</tr>
		<tr>
			<td>重复密码:</td>
			<td><input name="repassword" id="repassword" type="password" value=""/></td>
		</tr>
		<tr>
			<td>验证码:</td>
			<td><input name="code" id="code" type="text" value=""/></td>
		</tr>
		<tr>
			<td colspan="2" align="center"><input type="button" name="addButton" value="确定" onclick="doAdd()"/></td>
		</tr>
	</table>
	</form>
</body>
</html>